package systemInformation;

import org.snmp4j.smi.Integer32;

public enum ProcessType {
	unknown("Sconosciuto"), 
	operatingSystem("Sistema operativo"),
	deviceDriver("Driver"),
	application("Applicazione");
	
	private String description = null;
	
	private ProcessType(String description) {
		this.description = description;
	}

	public int getValue() {
		switch (this) {
		case unknown: default: return 1;
		case operatingSystem: return 2;
		case deviceDriver: return 3;
		case application: return 4;
		}
	}
	
	@Override
	public String toString() {
		return description;
	}
	
	public Integer32 toVariable() {
		return new Integer32(getValue());
	}
	
	public static ProcessType fromVariable(Integer32 variable) {
		return fromInt(variable.getValue());
	}
	
	public static ProcessType fromInt(int value) {
		switch (value) {
		case 1: default: return unknown;
		case 2: return operatingSystem;
		case 3: return deviceDriver;
		case 4: return application;
		}
	}
}
